var t = require("../../../@babel/runtime/helpers/interopRequireDefault"), e = t(require("../../../@babel/runtime/regenerator")), a = require("../../../@babel/runtime/helpers/toConsumableArray"), i = require("../../../@babel/runtime/helpers/asyncToGenerator"), s = t(require("../../../utils/api")), n = getApp();

Page({
    data: {
        statusBarHeight: n.globalData.statusBarHeight,
        tip: "下拉刷新更多内容",
        pageNum: 1,
        pageSize: 9,
        more: !0,
        list: [],
        finished: "",
        typical: !0
    },
    getList: function() {
        var t = this;
        return i(e.default.mark(function i() {
            var n, r, u, o;
            return e.default.wrap(function(e) {
                for (;;) switch (e.prev = e.next) {
                  case 0:
                    return n = wx.getStorageSync("openid"), e.prev = 1, e.next = 4, s.default.questionList({
                        openid: n,
                        finished: t.data.finished,
                        shared: t.data.typical,
                        pageNum: t.data.pageNum,
                        pageSize: t.data.pageSize
                    });

                  case 4:
                    r = e.sent, u = !(r.result.list.length < t.data.pageSize), (o = a(t.data.list)).push.apply(o, a(r.result.list)), 
                    u ? t.setData({
                        list: o,
                        more: u
                    }) : t.setData({
                        list: o,
                        more: u,
                        tip: "没有更多了"
                    }), e.next = 14;
                    break;

                  case 11:
                    e.prev = 11, e.t0 = e.catch(1), console.log(e.t0);

                  case 14:
                  case "end":
                    return e.stop();
                }
            }, i, null, [ [ 1, 11 ] ]);
        }))();
    },
    onShow: function() {
        this.setData({
            tip: "下拉刷新更多内容",
            pageNum: 1,
            pageSize: 9,
            more: !0,
            list: []
        }), this.getList();
    },
    onReachBottom: function() {
        this.data.more && (this.setData({
            pageNum: this.data.pageNum + 1
        }), this.getList());
    },
    tapdoing: function() {
        this.setData({
            finished: !1,
            typical: "",
            pageNum: 1,
            list: []
        }), this.getList();
    },
    tapdone: function() {
        this.setData({
            finished: !0,
            typical: "",
            pageNum: 1,
            list: []
        }), this.getList();
    },
    tapTypical: function() {
        this.setData({
            finished: "",
            typical: !0,
            pageNum: 1,
            list: []
        }), this.getList();
    },
    toNewQuestion: function() {
        wx.navigateTo({
            url: "/profile/pages/newQuestion/newQuestion"
        });
    },
    toDetail: function(t) {
        wx.navigateTo({
            url: "/profile/pages/questionDetail/questionDetail?id=" + t.currentTarget.dataset.id + "&finished=" + t.currentTarget.dataset.finished + "&anonymous=" + t.currentTarget.dataset.anonymous + "&typical=" + t.currentTarget.dataset.typical
        });
    },
    tapBack: function() {
        wx.navigateBack({
            delta: 1
        });
    }
});